package com.starsea.book.ui.newpage.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.starsea.book.databinding.ItemSearchBookRanksBinding
import com.starsea.book.ui.newpage.entity.BookInfoEntity

/**
 * @author Lee
 * @createTime 2024-07-12 20 GMT+8
 * @desc :
 */
class SearchBookRanksAdapter(var mContext: Context) :
    BaseQuickAdapter<BookInfoEntity, SearchBookRanksAdapter.MyViewHolder>() {


    var keyWord = ""

    override fun onBindViewHolder(holder: MyViewHolder, position: Int, item: BookInfoEntity?) {
        holder.binding.tvIndex.text = (position + 1).toString()
        holder.binding.tvTitle.text = item!!.bookTitle.plus(item.bookDesc)

    }

    override fun onCreateViewHolder(
        context: Context,
        parent: ViewGroup,
        viewType: Int,
    ): MyViewHolder {
        return MyViewHolder(parent = parent)
    }

    class MyViewHolder(
        parent: ViewGroup,
        val binding: ItemSearchBookRanksBinding = ItemSearchBookRanksBinding.inflate(
            LayoutInflater.from(parent.context), parent, false
        ),
    ) : RecyclerView.ViewHolder(binding.root)

}